<!DOCTYPE html>













<html class="theme-next gemini" lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">










  <meta name="google-site-verification" content="true">







  <meta name="baidu-site-verification" content="true">



  
  
  <link rel="stylesheet" href="/lib/fancybox/source/jquery.fancybox.css">







<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2">

<link rel="stylesheet" href="/css/main.css?v=7.1.2">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.1.2">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.ico?v=7.1.2">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.ico?v=7.1.2">


  <link rel="mask-icon" href="/images/logo.svg?v=7.1.2" color="#222">







<script id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '7.1.2',
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false,"dimmer":false},
    back2top: true,
    back2top_sidebar: true,
    fancybox: true,
    fastclick: false,
    lazyload: true,
    tabs: true,
    motion: {"enable":false,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="写在前面大家一定要区分站点配置文件和主题配置文件所在位置，因为两个文件的文件名相同，都是 _config.yml ，刚开始接触时容易混淆。如果大家按照步骤做完之后，没能达到效果，请优先检查所配置项的格式，比如 是否在需要加空格的地方忘记加空格。  站点配置文件： 位置在主目录下（主目录就是你博客初始化的目录）主题配置文件： 位置在themes文件夹下面的相应主题根目录（比如next主题的配置文">
<meta name="keywords" content="博客,hexo,next,主题">
<meta property="og:type" content="article">
<meta property="og:title" content="hexo站点配置+next主题配置（一）">
<meta property="og:url" content="https://melville.club/posts/a-2019-01-10-15-31-50.html">
<meta property="og:site_name" content="Melville&#39;s blog">
<meta property="og:description" content="写在前面大家一定要区分站点配置文件和主题配置文件所在位置，因为两个文件的文件名相同，都是 _config.yml ，刚开始接触时容易混淆。如果大家按照步骤做完之后，没能达到效果，请优先检查所配置项的格式，比如 是否在需要加空格的地方忘记加空格。  站点配置文件： 位置在主目录下（主目录就是你博客初始化的目录）主题配置文件： 位置在themes文件夹下面的相应主题根目录（比如next主题的配置文">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/hexo%E7%AB%99%E7%82%B9%E9%85%8D%E7%BD%AE_next%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE/%E7%BD%91%E7%AB%99%E5%9B%BE%E6%A0%87.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/hexo%E7%AB%99%E7%82%B9%E9%85%8D%E7%BD%AE_next%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE/leancloud_ID.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/hexo%E7%AB%99%E7%82%B9%E9%85%8D%E7%BD%AE_next%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE/leancloud_%E5%AE%89%E5%85%A8%E4%B8%AD%E5%BF%83.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/hexo%E7%AB%99%E7%82%B9%E9%85%8D%E7%BD%AE_next%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE/leancloud_create_class.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/hexo%E7%AB%99%E7%82%B9%E9%85%8D%E7%BD%AE_next%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE/leancloud_create_class_name.png">
<meta property="og:updated_time" content="2019-06-13T08:02:15.412Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="hexo站点配置+next主题配置（一）">
<meta name="twitter:description" content="写在前面大家一定要区分站点配置文件和主题配置文件所在位置，因为两个文件的文件名相同，都是 _config.yml ，刚开始接触时容易混淆。如果大家按照步骤做完之后，没能达到效果，请优先检查所配置项的格式，比如 是否在需要加空格的地方忘记加空格。  站点配置文件： 位置在主目录下（主目录就是你博客初始化的目录）主题配置文件： 位置在themes文件夹下面的相应主题根目录（比如next主题的配置文">
<meta name="twitter:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/hexo%E7%AB%99%E7%82%B9%E9%85%8D%E7%BD%AE_next%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE/%E7%BD%91%E7%AB%99%E5%9B%BE%E6%A0%87.png">



  <link rel="alternate" href="/atom.xml" title="Melville's blog" type="application/atom+xml">



  
  
  <link rel="canonical" href="https://melville.club/posts/a-2019-01-10-15-31-50">



<script id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>hexo站点配置+next主题配置（一） | Melville's blog</title>
  












  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Melville's blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <h1 class="site-subtitle" itemprop="description">业精于勤，荒于嬉</h1>
      
    
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">

    
    
    
      
    

    
      
    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-about">

    
    
    
      
    

    
      
    

    <a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">

    
    
    
      
    

    
      
    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签<span class="badge">38</span></a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">

    
    
    
      
    

    
      
    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类<span class="badge">13</span></a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">

    
    
    
      
    

    
      
    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档<span class="badge">20</span></a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-milestone">

    
    
    
      
    

    
      
    

    <a href="/milestone/" rel="section"><i class="menu-item-icon fa fa-fw fa-flag-checkered"></i> <br>里程碑</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-message">

    
    
    
      
    

    
      
    

    <a href="/message/" rel="section"><i class="menu-item-icon fa fa-fw fa-list-alt"></i> <br>留言板</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-commonweal">

    
    
    
      
    

    
      
    

    <a href="/404/" rel="section"><i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br>公益 404</a>

  </li>

      
      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>搜索</a>
        </li>
      
    </ul>
  

  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



  



</div>
    </header>

    
  
  

  

  <a href="https://github.com/do-do-do" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="external nofollow noopener noreferrer" target="_blank"><svg width="80" height="80" viewbox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"/><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"/><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"/></svg></a>



    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://melville.club/posts/a-2019-01-10-15-31-50.html">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Melville">
      <meta itemprop="description" content="改革春风吹满地">
      <meta itemprop="image" content="/images/avatar.png">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Melville's blog">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">hexo站点配置+next主题配置（一）

              
            
          </h2>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2019-01-10 15:31:50" itemprop="dateCreated datePublished" datetime="2019-01-10T15:31:50+08:00">2019-01-10</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2019-06-13 16:02:15" itemprop="dateModified" datetime="2019-06-13T16:02:15+08:00">2019-06-13</time>
              
            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing"><a href="/categories/博客/" itemprop="url" rel="index"><span itemprop="name">博客</span></a></span>

                
                
              
            </span>
          

          
            
            
              
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
            
                <span class="post-meta-item-text">评论数：</span>
                <a href="/posts/a-2019-01-10-15-31-50.html#comments" itemprop="discussionUrl">
                  <span class="post-comments-count valine-comment-count" data-xid="/posts/a-2019-01-10-15-31-50.html" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="post-meta-item-icon">
            <i class="fa fa-heart"></i>
             阅读次数： 
            <span class="busuanzi-value" id="busuanzi_value_page_pv"></span>
            </span>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <script type="text/javascript" src="/js/src/baidu.js"></script>

<h1 id="写在前面"><a href="#写在前面" class="headerlink" title="写在前面"></a>写在前面</h1><p>大家一定要区分站点配置文件和主题配置文件所在位置，因为两个文件的文件名相同，都是 <strong>_config.yml</strong> ，刚开始接触时容易混淆。如果大家按照步骤做完之后，没能达到效果，请优先检查所配置项的格式，比如 <strong>是否在需要加空格的地方忘记加空格</strong>。</p>
<blockquote>
<p><strong>站点配置文件：</strong> 位置在主目录下（主目录就是你博客初始化的目录）<br><strong>主题配置文件：</strong> 位置在themes文件夹下面的相应主题根目录（比如next主题的配置文件在 <code>/themes/next</code> 下面）</p>
</blockquote>
<a id="more"></a>
<h1 id="1-下载主题"><a href="#1-下载主题" class="headerlink" title="1. 下载主题"></a>1. 下载主题</h1><p> <strong><a href="https://hexo.io/themes/" rel="external nofollow noopener noreferrer" target="_blank">hexo主题下载</a></strong> ，里面有很多hexo的主题，选择一款喜欢的主题，点进去，会跳转到该主题的GitHub页面，download到本地。并将主题 <strong>文件夹</strong> 放到themes文件夹下面。然后在站点配置文件中更改为该主题，就可以使用了，下面会介绍如何更改。</p>
<h1 id="2-站点配置"><a href="#2-站点配置" class="headerlink" title="2. 站点配置"></a>2. 站点配置</h1><h2 id="2-1-站点文件的基本配置参数"><a href="#2-1-站点文件的基本配置参数" class="headerlink" title="2.1 站点文件的基本配置参数"></a>2.1 站点文件的基本配置参数</h2><p><strong>网站</strong></p>
<table>
<thead>
<tr>
<th>参数</th>
<th>描述</th>
<th>默认值</th>
</tr>
</thead>
<tbody>
<tr>
<td>title</td>
<td>网站标题</td>
<td></td>
</tr>
<tr>
<td>subtitle</td>
<td>网站副标题</td>
<td></td>
</tr>
<tr>
<td>description</td>
<td>网站描述</td>
<td></td>
</tr>
<tr>
<td>keywords</td>
<td>网站关键词</td>
<td></td>
</tr>
<tr>
<td>author</td>
<td>你的名字</td>
<td></td>
</tr>
<tr>
<td>language</td>
<td>网站使用的语言</td>
<td></td>
</tr>
<tr>
<td>timezone</td>
<td>网站时区</td>
<td>Hexo 默认使用您电脑的时区</td>
</tr>
</tbody>
</table>
<p><strong>网址</strong></p>
<table>
<thead>
<tr>
<th>参数</th>
<th>描述</th>
<th>默认值</th>
</tr>
</thead>
<tbody>
<tr>
<td>url</td>
<td>网址</td>
<td></td>
</tr>
<tr>
<td>root</td>
<td>网站根目录</td>
<td></td>
</tr>
<tr>
<td>permalink</td>
<td>文章的 永久链接 格式</td>
<td>:year/:month/:day/:title/</td>
</tr>
<tr>
<td>permalink_defaults</td>
<td>永久链接中各部分的默认值</td>
<td></td>
</tr>
</tbody>
</table>
<blockquote>
<p>如果您的网站存放在子目录中，例如 <a href="http://yoursite.com/blog，" rel="external nofollow noopener noreferrer" target="_blank">http://yoursite.com/blog，</a><br>则请将您的 url 设为 <a href="http://yoursite.com/blog" rel="external nofollow noopener noreferrer" target="_blank">http://yoursite.com/blog</a> 并把 root 设为 /blog/。</p>
</blockquote>
<p><strong>目录</strong></p>
<table>
<thead>
<tr>
<th>参数</th>
<th>描述</th>
<th>默认值</th>
</tr>
</thead>
<tbody>
<tr>
<td>source_dir</td>
<td>资源文件夹，这个文件夹用来存放内容</td>
<td>source</td>
</tr>
<tr>
<td>public_dir</td>
<td>公共文件夹，这个文件夹用于存放生成的站点文件。</td>
<td>public</td>
</tr>
<tr>
<td>tag_dir</td>
<td>标签文件夹</td>
<td>tags</td>
</tr>
<tr>
<td>archive_dir</td>
<td>归档文件夹</td>
<td>archives</td>
</tr>
<tr>
<td>category_dir</td>
<td>分类文件夹</td>
<td>categories</td>
</tr>
<tr>
<td>code_dir</td>
<td>Include code 文件夹</td>
<td>downloads/code</td>
</tr>
<tr>
<td>i18n_dir</td>
<td>国际化（i18n）文件夹</td>
<td>:lang</td>
</tr>
<tr>
<td>skip_render</td>
<td>跳过指定文件的渲染，您可使用 glob 表达式来匹配路径。    </td>
</tr>
</tbody>
</table>
<blockquote>
<p><strong>注意：</strong> 如果您刚刚开始接触Hexo，通常没有必要修改这一部分的值。</p>
</blockquote>
<p><strong>文章</strong></p>
<table>
<thead>
<tr>
<th>参数</th>
<th>描述</th>
<th>默认值</th>
</tr>
</thead>
<tbody>
<tr>
<td>new_post_name</td>
<td>新文章的文件名称</td>
<td>:title.md</td>
</tr>
<tr>
<td>default_layout</td>
<td>预设布局</td>
<td>post</td>
</tr>
<tr>
<td>auto_spacing</td>
<td>在中文和英文之间加入空格</td>
<td>false</td>
</tr>
<tr>
<td>titlecase</td>
<td>把标题转换为 title case</td>
<td>false</td>
</tr>
<tr>
<td>external_link</td>
<td>在新标签中打开链接</td>
<td>true</td>
</tr>
<tr>
<td>filename_case</td>
<td>把文件名称转换为 (1) 小写或 (2) 大写</td>
<td>0</td>
</tr>
<tr>
<td>render_drafts</td>
<td>显示草稿</td>
<td>false</td>
</tr>
<tr>
<td>post_asset_folder</td>
<td>启动 Asset 文件夹</td>
<td>false</td>
</tr>
<tr>
<td>relative_link</td>
<td>把链接改为与根目录的相对位址</td>
<td>false</td>
</tr>
<tr>
<td>future</td>
<td>显示未来的文章</td>
<td>true</td>
</tr>
<tr>
<td>highlight</td>
<td>代码块的设置</td>
</tr>
</tbody>
</table>
<blockquote>
<p><strong>相对地址：</strong> 默认情况下，Hexo生成的超链接都是绝对地址。例如，如果您的网站域名为 example.com，您有一篇文章名为hello，那么绝对链接可能像这样：<a href="http://example.com/hello.html，" rel="external nofollow noopener noreferrer" target="_blank">http://example.com/hello.html，</a> 它是绝对于域名的。相对链接像这样：/hello.html，也就是说，无论用什么域名访问该站点，都没有关系，这在进行反向代理时可能用到。通常情况下，建议使用绝对地址。</p>
</blockquote>
<p><strong>分类 &amp; 标签</strong></p>
<table>
<thead>
<tr>
<th>参数</th>
<th>描述</th>
<th>默认值</th>
</tr>
</thead>
<tbody>
<tr>
<td>default_category</td>
<td>默认分类</td>
<td>uncategorized</td>
</tr>
<tr>
<td>category_map</td>
<td>分类别名</td>
<td></td>
</tr>
<tr>
<td>tag_map</td>
<td>标签别名</td>
<td></td>
</tr>
</tbody>
</table>
<p><strong>日期 / 时间格式</strong></p>
<table>
<thead>
<tr>
<th>参数</th>
<th>描述</th>
<th>默认值</th>
</tr>
</thead>
<tbody>
<tr>
<td>date_format</td>
<td>日期格式</td>
<td>YYYY-MM-DD</td>
</tr>
<tr>
<td>time_format</td>
<td>时间格式</td>
<td>HH:mm:ss</td>
</tr>
</tbody>
</table>
<blockquote>
<p>Hexo 使用 Moment.js 来解析和显示时间。</p>
</blockquote>
<p><strong>分页</strong></p>
<table>
<thead>
<tr>
<th>参数</th>
<th>描述</th>
<th>默认值</th>
</tr>
</thead>
<tbody>
<tr>
<td>per_page</td>
<td>每页显示的文章量 (0 = 关闭分页功能)</td>
<td>10</td>
</tr>
<tr>
<td>pagination_dir</td>
<td>分页目录</td>
<td>page</td>
</tr>
</tbody>
</table>
<p><strong>扩展</strong></p>
<table>
<thead>
<tr>
<th>参数</th>
<th>描述</th>
<th>备注</th>
</tr>
</thead>
<tbody>
<tr>
<td>Plugins</td>
<td>插件</td>
<td></td>
</tr>
<tr>
<td>Themes</td>
<td>当前主题名称</td>
<td>值为false时禁用主题</td>
</tr>
</tbody>
</table>
<p><strong>部署</strong></p>
<table>
<thead>
<tr>
<th>参数</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td>部署类型</td>
</tr>
<tr>
<td>repo</td>
<td>仓库地址</td>
</tr>
<tr>
<td>branch</td>
<td>仓库分支</td>
</tr>
</tbody>
</table>
<h2 id="2-2-参数配置"><a href="#2-2-参数配置" class="headerlink" title="2.2 参数配置"></a>2.2 参数配置</h2><p>我只介绍平时比较关注的配置，其它配置项大家自己摸索。</p>
<h3 id="2-2-1-配置网站"><a href="#2-2-1-配置网站" class="headerlink" title="2.2.1 配置网站"></a>2.2.1 配置网站</h3><p>以下是我的网站配置</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">title: Melville&apos;s blog</span><br><span class="line">subtitle: 个人博客</span><br><span class="line">description: 改革春风吹满地</span><br><span class="line">keywords:</span><br><span class="line">author: Melville</span><br><span class="line">language: zh-Hans         # 网站语言设置为中文</span><br><span class="line">timezone:</span><br></pre></td></tr></table></figure>
<h3 id="2-2-2-配置网址"><a href="#2-2-2-配置网址" class="headerlink" title="2.2.2 配置网址"></a>2.2.2 配置网址</h3><p>以下是我的网址配置，<strong>URL</strong> 配置成自己的网址，<a href="https:melville.club" target="_blank" rel="noopener">https:melville.club</a> 是我的自定义域名，如果没有自定义域名，配置成GitHub Pages分配的网址即可。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">url: https:melville.club</span><br><span class="line">root: /</span><br><span class="line">permalink: :title.html</span><br><span class="line">permalink_defaults:</span><br></pre></td></tr></table></figure>
<h3 id="2-2-3-配置主题"><a href="#2-2-3-配置主题" class="headerlink" title="2.2.3 配置主题"></a>2.2.3 配置主题</h3><p>默认主题是 <strong>landscape</strong>，替换成自己下载的主题的 <strong>文件夹的名字</strong> （如果主题文件夹的名字不是主题的名字，建议改成一致），我的是next主题（刚下载下来时，主题文件夹的名字是 <strong>hexo-theme-next-master</strong> ，我将其改成了 <strong>next</strong>），所以我的 <strong>themes</strong> 文件夹下面有 <code>/themes/landscape</code> 和 <code>/themes/next</code> 两个主题。使用一个主题，将其它主题注掉即可。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">## theme: landscape</span><br><span class="line">theme: next</span><br></pre></td></tr></table></figure>
<h3 id="2-2-4-配置部署参数"><a href="#2-2-4-配置部署参数" class="headerlink" title="2.2.4 配置部署参数"></a>2.2.4 配置部署参数</h3><p>以下是我的部署参数配置，<strong>repo</strong> 在GitHub新建的GitHub Pages仓库中获取。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line">  type: git</span><br><span class="line">  repo: git@github.com:do-do-do/do-do-do.github.io.git</span><br><span class="line">  branch: master</span><br></pre></td></tr></table></figure>
<h1 id="3-主题配置"><a href="#3-主题配置" class="headerlink" title="3. 主题配置"></a>3. 主题配置</h1><p>接下来就可以进行主题的配置了，本文以next主题为例子，其它主题配置方法类似。</p>
<h2 id="3-1-选择主题风格-Scheme"><a href="#3-1-选择主题风格-Scheme" class="headerlink" title="3.1 选择主题风格 Scheme"></a>3.1 选择主题风格 Scheme</h2><p>Scheme 是 NexT 提供的一种特性，借助于 Scheme，NexT 为你提供多种不同的外观。同时，几乎所有的配置都可以 在 Scheme 之间共用。目前 NexT 支持四种 Scheme，他们是：</p>
<ul>
<li>Muse： 默认 Scheme，这是 NexT 最初的版本，黑白主调，大量留白</li>
<li>Mist： Muse 的紧凑版本，整洁有序的单栏外观</li>
<li>Pisces： 双栏 Scheme，小家碧玉似的清新</li>
<li>Gemini： 双兰Scheme，简洁美观<br>Scheme 的切换通过更改 <strong>主题配置文件</strong>，搜索 scheme 关键字。你会看到有四行 scheme 的配置，将你需用启用的 scheme 前面注释 <code>#</code> 去除即可。</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">#scheme: Muse   </span><br><span class="line">#scheme: Mist  </span><br><span class="line">#scheme: Pisces</span><br><span class="line">scheme: Gemini</span><br></pre></td></tr></table></figure>
<h2 id="3-2-设置语言"><a href="#3-2-设置语言" class="headerlink" title="3.2 设置语言"></a>3.2 设置语言</h2><p>编辑 <strong>站点配置文件</strong>， 将 <code>language</code> 设置成你所需要的语言。建议明确设置你所需要的语言，例如选用简体中文，配置如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">language: zh-Hans</span><br></pre></td></tr></table></figure>
<p>目前 NexT 支持的语言如以下表格所示：</p>
<table>
<thead>
<tr>
<th>语言</th>
<th>代码</th>
<th>设定示例</th>
</tr>
</thead>
<tbody>
<tr>
<td>English</td>
<td>en</td>
<td>language: en</td>
</tr>
<tr>
<td>简体中文</td>
<td>zh-Hans</td>
<td>language: zh-Hans</td>
</tr>
<tr>
<td>Français</td>
<td>fr-FR</td>
<td>language: fr-FR</td>
</tr>
<tr>
<td>Português</td>
<td>pt</td>
<td>language: pt or language: pt-BR</td>
</tr>
<tr>
<td>繁體中文</td>
<td>zh-hk 或者 zh-tw</td>
<td>language: zh-hk</td>
</tr>
<tr>
<td>Русский язык</td>
<td>ru</td>
<td>language: ru</td>
</tr>
<tr>
<td>Deutsch</td>
<td>de</td>
<td>language: de</td>
</tr>
<tr>
<td>日本語</td>
<td>ja</td>
<td>language: ja</td>
</tr>
<tr>
<td>Indonesian</td>
<td>id</td>
<td>language: id</td>
</tr>
<tr>
<td>Korean</td>
<td>ko</td>
<td>language: ko</td>
</tr>
</tbody>
</table>
<h2 id="3-3-设置菜单设置"><a href="#3-3-设置菜单设置" class="headerlink" title="3.3 设置菜单设置"></a>3.3 设置菜单设置</h2><p>菜单配置包括三个部分，第一是菜单项（名称和链接），第二是菜单项的显示文本，第三是菜单项对应的图标。 NexT 使用的是 <a href="http://fontawesome.io/" rel="external nofollow noopener noreferrer" target="_blank">Font Awesome</a> 提供的图标， <code>Font Awesome</code> 提供了 600+ 的图标，可以满足绝大的多数的场景，同时无须担心在 Retina 屏幕下 图标模糊的问题。</p>
<p>编辑 <strong>主题配置文件</strong>，修改以下内容：</p>
<p><strong>a.</strong> 设定菜单内容，对应的字段是 menu。 菜单内容的设置格式是： <strong>名称: 归档位置 || 图标</strong>。其中名称并不直接显示在页面上，它将用于匹配图标以及翻译。默认是没有那么多菜单项的，下面会教大家怎么创建菜单项。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">menu:</span><br><span class="line">  home: / || home</span><br><span class="line">  #about: /about/ || user</span><br><span class="line">  #tags: /tags/ || tags</span><br><span class="line">  #categories: /categories/ || th</span><br><span class="line">  archives: /archives/ || archive</span><br><span class="line">  #schedule: /schedule/ || calendar</span><br><span class="line">  #sitemap: /sitemap.xml || sitemap</span><br><span class="line">  #commonweal: /404/ || heartbeat</span><br></pre></td></tr></table></figure>
<blockquote>
<p>若你的站点运行在子目录中，请将链接前缀的 <code>/</code> 去掉</p>
</blockquote>
<p><strong>b.</strong> 添加标签、分类等页面</p>
<p>刚开始是没有那么多菜单项的，我们需要自己手动创建，比如添加 <strong>分类（categories）</strong> 页面，输入下面的指令</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo new page categories</span><br></pre></td></tr></table></figure>
<p>这时候会在hexo中的source目录下面生成一个 <code>categories</code> 文件夹，这是文件夹就是博客文章 <strong>分类页面</strong> 的归档。<br>创建完成之后，我们需要在 <strong>主题配置文件</strong> 中，将 <code>menu</code> 中的 <code>categories</code> 前面的 <code>#</code> 去掉。重新 <code>hexo g -d</code> 部署后，就可以看到页面多了一个分类项。大家可以根据需要创建其它的菜单项，比如 <code>tags（标签）、about（关于）</code> 等等。</p>
<p>创建了这些菜单项有什么用呢？各个菜单项的用法各不相同，我只介绍三个常用的菜单项，<strong>tags、archives、categories</strong>。<br>这三个项是比较特殊的，他们的页面在 <code>/themes/layout/</code> 下面已经给出来了，就是相应的 <code>.swig</code> 文件。我们一般不用动它，只要知道如何使用就行了。</p>
<p>我们新建一片博客，只需要在博客开头给文章做好分类和标签即可，<code>archives</code> 不用关心，hexo自己会将你的博客归档。如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">title: hexo站点配置+next主题配置</span><br><span class="line">tags:</span><br><span class="line">  - 博客</span><br><span class="line">  - hexo</span><br><span class="line">  - next</span><br><span class="line">  - 主题</span><br><span class="line">categories:</span><br><span class="line">  - 博客</span><br><span class="line">date: 2019-01-10 15:31:50</span><br></pre></td></tr></table></figure>
<p><strong>c.</strong> 设置菜单项的显示文本。在第一步和第二步中设置的菜单的名称并不直接用于界面上的展示。Hexo 在生成的时候将使用 这个名称查找对应的语言翻译，并提取显示文本。这些翻译文本放置在 NexT 主题目录下的 <strong>languages/{language}.yml （{language} 为你所使用的语言）</strong>。</p>
<p>以简体中文为例，若你需要添加一个菜单项，比如 <code>search</code>。那么就需要修改简体中文对应的翻译文件 <code>languages/zh-Hans.yml</code>，在 <code>menu</code> 字段下添加一项：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">menu:</span><br><span class="line">  home: 首页</span><br><span class="line">  archives: 归档</span><br><span class="line">  categories: 分类</span><br><span class="line">  tags: 标签</span><br><span class="line">  about: 关于</span><br><span class="line">  search: 搜索</span><br></pre></td></tr></table></figure>
<p><strong>d.</strong> 设定菜单项图标。大家可以从 <a href="http://fontawesome.io/" rel="external nofollow noopener noreferrer" target="_blank">Font Awesome</a> 上查找喜欢的图标，并拷贝其图标名称，替换掉 <code>menu</code> 项中 <code>||</code> 后面的图标名称即可。</p>
<h2 id="3-4-设置侧边栏位置及显示"><a href="#3-4-设置侧边栏位置及显示" class="headerlink" title="3.4 设置侧边栏位置及显示"></a>3.4 设置侧边栏位置及显示</h2><p>默认情况下，侧栏仅在文章页面（拥有目录列表）时才显示，并放置于右侧位置。 可以通过修改 <strong>主题配置文件</strong> 中的 <code>sidebar</code>  字段来控制侧栏的行为。侧栏的设置包括两个部分，其一是侧栏的位置， 其二是侧栏显示的时机。</p>
<p>设置侧栏的位置，修改 <code>sidebar.position</code> 的值，支持的选项有：</p>
<ul>
<li><code>left</code> - 靠左放置</li>
<li><code>right</code> - 靠右放置</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sidebar:</span><br><span class="line">  position: left</span><br></pre></td></tr></table></figure>
<p>设置侧栏显示的时机，修改 <code>sidebar.display</code> 的值，支持的选项有：</p>
<ul>
<li><code>post</code> - 默认行为，在文章页面（拥有目录列表）时显示</li>
<li><code>always</code> - 在所有页面中都显示</li>
<li><code>hide</code> - 在所有页面中都隐藏（可以手动展开）</li>
<li><code>remove</code> - 完全移除</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sidebar:</span><br><span class="line">  display: post</span><br></pre></td></tr></table></figure>
<h2 id="3-5-添加侧边栏社交链接"><a href="#3-5-添加侧边栏社交链接" class="headerlink" title="3.5 添加侧边栏社交链接"></a>3.5 添加侧边栏社交链接</h2><p>给侧边栏添加社交链接，可以通过修改 <strong>主题配置文件</strong> 中的 <code>social</code> 字段来添加。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">#social:</span><br><span class="line">  #GitHub: https://github.com/yourname || github</span><br><span class="line">  #E-Mail: mailto:yourname@gmail.com || envelope</span><br><span class="line">  #Weibo: https://weibo.com/yourname || weibo</span><br><span class="line">  #Google: https://plus.google.com/yourname || google</span><br><span class="line">  #Twitter: https://twitter.com/yourname || twitter</span><br><span class="line">  #FB Page: https://www.facebook.com/yourname || facebook</span><br><span class="line">  #VK Group: https://vk.com/yourname || vk</span><br><span class="line">  #StackOverflow: https://stackoverflow.com/yourname || stack-overflow</span><br><span class="line">  #YouTube: https://youtube.com/yourname || youtube</span><br><span class="line">  #Instagram: https://instagram.com/yourname || instagram</span><br><span class="line">  #Skype: skype:yourname?call|chat || skype</span><br></pre></td></tr></table></figure>
<p>next主题默认是不打开 <code>social</code> 的，我们把 <code>social</code> 前面的 <code>#</code> 删掉，添加自己的社交链接即可，格式为 <strong>“名称: 社交网址 || 图标”</strong>, <font color="#FF0000"><strong>注意空格</strong></font> 。</p>
<h2 id="3-6-关闭网站动画效果"><a href="#3-6-关闭网站动画效果" class="headerlink" title="3.6 关闭网站动画效果"></a>3.6 关闭网站动画效果</h2><p>每次打开网页的时候，是不是感觉加载很慢？这是因为next主题的一些动画效果导致的，我们可以通过修改 <strong>主题配置文件</strong> 中的 <code>motion</code> 字段来关闭它。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">motion:</span><br><span class="line">  enable: false</span><br></pre></td></tr></table></figure>
<p>部署后再打开网页试试，是不是快到飞起。</p>
<h2 id="3-7-设置网站图标"><a href="#3-7-设置网站图标" class="headerlink" title="3.7 设置网站图标"></a>3.7 设置网站图标</h2><p>自己的博客当然要用自己的网站图标，在没设置自己的网站图标时，浏览器的标签上显示的是next主题的图标 <code>N</code> ，下面是我自己设置的图标。</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/hexo%E7%AB%99%E7%82%B9%E9%85%8D%E7%BD%AE_next%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE/%E7%BD%91%E7%AB%99%E5%9B%BE%E6%A0%87.png" alt=""></p>
<p>我们可以修改 <strong>主题配置文件</strong> 中的 <code>favicon</code> 字段来设置网站图标，首先我们需要先制作自己的图标，可以通过 <a href="http://www.bitbug.net/" rel="external nofollow noopener noreferrer" target="_blank">比特虫</a> 来制作图标，需要制作 <code>16x16</code> 和 <code>32x32</code> 两个大小的图标，分别重命名为 <code>favicon-16x16-next.ico</code> 和 <code>favicon-32x32-next.ico</code>,然后将两个图标文件放在 <code>/source/images</code> 目录下，并修改配置。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">favicon:</span><br><span class="line">  small: /images/favicon-16x16-next.ico</span><br><span class="line">  medium: /images/favicon-32x32-next.ico</span><br></pre></td></tr></table></figure>
<h2 id="3-8-设置头像"><a href="#3-8-设置头像" class="headerlink" title="3.8 设置头像"></a>3.8 设置头像</h2><p>选好自己喜欢的头像，将其命名为 <code>avatar.png</code> 也可以是 <code>.gif</code> 文件，并放在 <code>source/images</code> 目录下，修改 <strong>主题配置文件</strong> 的 <code>avatar</code> 字段。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"># Sidebar Avatar</span><br><span class="line">avatar:</span><br><span class="line">  # in theme directory(source/images): /images/avatar.gif</span><br><span class="line">  # in site  directory(source/uploads): /uploads/avatar.gif</span><br><span class="line">  # You can also use other linking images.</span><br><span class="line">  url: /images/avatar.png</span><br></pre></td></tr></table></figure>
<p>比较老的next版本，是直接修改 <code>avatar</code> 字段</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"># Sidebar Avatar</span><br><span class="line"># in theme directory(source/images): /images/avatar.gif</span><br><span class="line"># in site  directory(source/uploads): /uploads/avatar.gif</span><br><span class="line">avatar: /images/avatar.png</span><br></pre></td></tr></table></figure>
<h2 id="3-9-网页底部显示建站时间和图标修改"><a href="#3-9-网页底部显示建站时间和图标修改" class="headerlink" title="3.9 网页底部显示建站时间和图标修改"></a>3.9 网页底部显示建站时间和图标修改</h2><p>修改 <strong>主题配置文件</strong> 中的 <code>footer</code> 字段，将 <code>since</code> 修改成建站时间，<code>icon</code> 修改图标，可以从 <a href="http://fontawesome.io/" rel="external nofollow noopener noreferrer" target="_blank">Font Awesome</a> 中查找自己喜欢的图标。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">footer:</span><br><span class="line">  # Specify the date when the site was setup.</span><br><span class="line">  # If not defined, current year will be used.</span><br><span class="line">  since: 2018</span><br><span class="line"></span><br><span class="line">  # Icon between year and copyright info.</span><br><span class="line">  icon: snowflake-o      # snowflake-o是雪花的图标，默认是 user</span><br></pre></td></tr></table></figure>
<h2 id="3-10-去掉网站底部显示的-“由hexo强力驱动”-字样"><a href="#3-10-去掉网站底部显示的-“由hexo强力驱动”-字样" class="headerlink" title="3.10 去掉网站底部显示的 “由hexo强力驱动” 字样"></a>3.10 去掉网站底部显示的 “由hexo强力驱动” 字样</h2><p>修改 <strong>主题配置文件</strong> 中的 <code>footer</code> 字段，将 <code>powered</code> 设置为 <code>false</code>。</p>
<h2 id="3-11-增加评论功能"><a href="#3-11-增加评论功能" class="headerlink" title="3.11 增加评论功能"></a>3.11 增加评论功能</h2><p>next主题支持多种评论系统，像是多说、网易云跟帖、畅言、Gitment、Disqus、Hypercomments、valine，多说和网易云跟帖已经挂了，Gitment的服务器也不行了，Disqus、Hypercomments是国外的，速度慢，目前只有 <code>valine</code> 好用一些。首先进入 <a href="https://leancloud.cn/" rel="external nofollow noopener noreferrer" target="_blank">leancloud官网</a> 注册一个valine账号。</p>
<p>注册完之后需要创建应用，应用名字没有特别要求，然后进入应用，找到 <strong>设置-&gt;应用Key</strong> ，会看到有 <code>App ID</code> 和 <code>App Key</code> 。</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/hexo%E7%AB%99%E7%82%B9%E9%85%8D%E7%BD%AE_next%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE/leancloud_ID.png" alt=""></p>
<p>进入 <strong>主题配置文件</strong> ，找到 <code>valine</code> 字段，将你的 <code>App ID</code> 和 <code>App Key</code> 分别填到 appid 和 appkey 的位置上，将 <code>enable</code> 改成 true。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">valine:</span><br><span class="line">  enable: true</span><br><span class="line">  appid:  ???? # your leancloud application appid</span><br><span class="line">  appkey: ???? # your leancloud application appkey</span><br><span class="line">  notify: false # mail notifier , https://github.com/xCss/Valine/wiki</span><br><span class="line">  verify: false # Verification code</span><br><span class="line">  placeholder: 老铁，说点啥... # comment box placeholder</span><br><span class="line">  avatar: mp # gravatar style</span><br><span class="line">  guest_info: nick,mail,link # custom comment header</span><br><span class="line">  pageSize: 10 # pagination size</span><br></pre></td></tr></table></figure>
<p>然后进入 <strong>设置-&gt;安全中心</strong> ，服务开关只保留 <strong>数据存储</strong> 即可，Web安全域名中添加上自己的博客域名。</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/hexo%E7%AB%99%E7%82%B9%E9%85%8D%E7%BD%AE_next%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE/leancloud_%E5%AE%89%E5%85%A8%E4%B8%AD%E5%BF%83.png" alt=""></p>
<p>修改完后，部署到网站上，此时文章底部应该出现了评论框。</p>
<h2 id="3-12-禁用指定文章的评论功能"><a href="#3-12-禁用指定文章的评论功能" class="headerlink" title="3.12 禁用指定文章的评论功能"></a>3.12 禁用指定文章的评论功能</h2><p><code>valine</code> 评论系统默认所有页面都可以评论，包括关于页面、标签页面，很明显，我们并不是所有页面都需要评论功能。怎么关闭这些页面的评论功能呢？很简单，在文章开头加上 <code>comments</code> 限定就行。<code>&quot;comments: false&quot;</code> 关闭评论， <code>&quot;comments: true&quot;</code> 打开评论，比如禁止博客文章的评论：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">title: hexo站点配置+next主题配置</span><br><span class="line">tags:</span><br><span class="line">  - 博客</span><br><span class="line">  - hexo</span><br><span class="line">  - next</span><br><span class="line">  - 主题</span><br><span class="line">categories:</span><br><span class="line">  - 博客</span><br><span class="line">comments: false</span><br><span class="line">date: 2019-01-10 15:31:50</span><br></pre></td></tr></table></figure>
<p>像是关于页面、标签页面，他们的文件是在 <code>source</code> 目录相应文件夹下的 <code>index.md</code> 文件。加上 <code>&quot;comments: false&quot;</code> 就可以了。</p>
<h2 id="3-13-增加阅读统计"><a href="#3-13-增加阅读统计" class="headerlink" title="3.13 增加阅读统计"></a>3.13 增加阅读统计</h2><p>在 <strong>3.11</strong> 章节中我们创建了leancloud账户，阅读统计的功能使用leancloud就可以实现，登录leancloud，进入 <strong>应用-&gt;存储-&gt;创建Class</strong> ，</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/hexo%E7%AB%99%E7%82%B9%E9%85%8D%E7%BD%AE_next%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE/leancloud_create_class.png" alt=""></p>
<p>创建Class时，名称一定要是 <strong>Counter</strong> ，这是为了适配 next 主题，由于LeanCloud升级了默认的ACL权限，如果你想避免后续因为权限的问题导致次数统计显示不正常，建议在此处选择 <strong>无限制</strong>。</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/hexo%E7%AB%99%E7%82%B9%E9%85%8D%E7%BD%AE_next%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE/leancloud_create_class_name.png" alt=""></p>
<p>创建完成之后，左侧数据栏应该会多出一栏名为 <strong>Counter</strong> 的栏目，前面带下划线的栏目都是系统预定好的表。在 <strong>主题配置文件</strong> 中搜索 <code>leancloud_visitors</code> 修改配置，将你的 <code>appid</code> 和 <code>appkey</code> 填入相应位置。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">leancloud_visitors:</span><br><span class="line">  enable: true</span><br><span class="line">  app_id: </span><br><span class="line">  app_key:</span><br></pre></td></tr></table></figure>
<h2 id="3-14-开启微信支付宝打赏功能"><a href="#3-14-开启微信支付宝打赏功能" class="headerlink" title="3.14 开启微信支付宝打赏功能"></a>3.14 开启微信支付宝打赏功能</h2><p>越来越多的平台（微信公众平台，新浪微博，简书，百度打赏等）支持打赏功能，付费阅读时代越来越近，特此增加了打赏功能，支持微信打赏和支付宝打赏。只需要  <strong>主题配置文件</strong> 中填入微信和支付宝收款二维码图片地址，即可开启该功能。将微信和支付宝的收款二维码放在 <code>/themes/next/images</code> 目录下，并分别重命名为 <strong>“wechatpay.jpg”</strong> 和 <strong>“alipay.jpg”</strong> ，修改配置：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">reward:</span><br><span class="line">  enable: true</span><br><span class="line">  wechatpay: /images/wechatpay.jpg</span><br><span class="line">  alipay: /images/alipay.jpg</span><br></pre></td></tr></table></figure>
<h2 id="3-15-修改打赏部分字体动画"><a href="#3-15-修改打赏部分字体动画" class="headerlink" title="3.15 修改打赏部分字体动画"></a>3.15 修改打赏部分字体动画</h2><p>Next打赏部分的动画是鬼畜一般的不停地抖动，看着很难受，所以博主把它改为只循环三遍，打开文件 <code>themes/next/source/css/_common/components/post/post-reward.styl</code> ，把微信和支付宝的动画代码注释即可，如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">/* 关闭文字闪动</span><br><span class="line">#wechat:hover p&#123;</span><br><span class="line">    animation: roll 0.1s infinite linear;</span><br><span class="line">    -webkit-animation: roll 0.1s infinite linear;</span><br><span class="line">    -moz-animation: roll 0.1s infinite linear;</span><br><span class="line">&#125;</span><br><span class="line">#alipay:hover p&#123;</span><br><span class="line">    animation: roll 0.1s infinite linear;</span><br><span class="line">    -webkit-animation: roll 0.1s infinite linear;</span><br><span class="line">    -moz-animation: roll 0.1s infinite linear;</span><br><span class="line">&#125;</span><br><span class="line">*/</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h2 id="3-16-增加公益404页面"><a href="#3-16-增加公益404页面" class="headerlink" title="3.16 增加公益404页面"></a>3.16 增加公益404页面</h2><p>新建 <code>公益404页面</code> </p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo new page 404</span><br></pre></td></tr></table></figure>
<p>修改 <code>&quot;/source/404/index.md&quot;</code> ，添加以下代码：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE HTML&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">&lt;head&gt;</span><br><span class="line">  &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=utf-8;&quot;/&gt;</span><br><span class="line">  &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge,chrome=1&quot; /&gt;</span><br><span class="line">  &lt;meta name=&quot;robots&quot; content=&quot;all&quot; /&gt;</span><br><span class="line">  &lt;meta name=&quot;robots&quot; content=&quot;index,follow&quot;/&gt;</span><br><span class="line">  &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;https://qzone.qq.com/gy/404/style/404style.css&quot;&gt;</span><br><span class="line">&lt;/head&gt;</span><br><span class="line">&lt;body&gt;</span><br><span class="line">  &lt;script type=&quot;text/plain&quot; src=&quot;http://www.qq.com/404/search_children.js&quot;</span><br><span class="line">          charset=&quot;utf-8&quot; homePageUrl=&quot;/&quot;</span><br><span class="line">          homePageName=&quot;回到我的主页&quot;&gt;</span><br><span class="line">  &lt;/script&gt;</span><br><span class="line">  &lt;script src=&quot;https://qzone.qq.com/gy/404/data.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;</span><br><span class="line">  &lt;script src=&quot;https://qzone.qq.com/gy/404/page.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;</span><br><span class="line">&lt;/body&gt;</span><br><span class="line">&lt;/html&gt;</span><br></pre></td></tr></table></figure>
<p>在 <strong>主题配置文件</strong> 中，修改 <code>menu</code> ，添加404，如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">menu:</span><br><span class="line">  home: / || home</span><br><span class="line">  tags: /tags/ || tags</span><br><span class="line">  categories: /categories/ || th</span><br><span class="line">  archives: /archives/ || archive</span><br><span class="line">  about: /about/ || user</span><br><span class="line">  commonweal: /404/ || heartbeat</span><br></pre></td></tr></table></figure>
<p><a href="https://melville.club/posts/a-2019-01-15-15-32-00.html"> <strong>hexo站点配置+next主题配置（二）</strong> </a></p>
<hr>

      
    </div>

    

    
    
    

    
        
<div class="my_post_copyright">
  <script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"></script>
  
  <!-- JS库 sweetalert 可修改路径 -->
  <script src="https://cdn.bootcss.com/jquery/2.0.0/jquery.min.js"></script>
  <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
  <p><span>本文标题:</span><a href="/posts/a-2019-01-10-15-31-50.html">hexo站点配置+next主题配置（一）</a></p>
  <p><span>文章作者:</span><a href="/" title="访问 Melville 的个人博客">Melville</a></p>
  <p><span>发布时间:</span>2019年01月10日 - 15:31</p>
  <p><span>最后更新:</span>2019年06月13日 - 16:02</p>
  <p><span>原始链接:</span><a href="/posts/a-2019-01-10-15-31-50.html" title="hexo站点配置+next主题配置（一）">https://melville.club/posts/a-2019-01-10-15-31-50.html</a>
    <span class="copy-path" title="点击复制文章链接"><i class="fa fa-clipboard" data-clipboard-text="https://melville.club/posts/a-2019-01-10-15-31-50.html" aria-label="复制成功！"></i></span>
  </p>
  <p><span>许可协议:</span><i class="fa fa-creative-commons"></i> <a rel="external nofollow noopener noreferrer" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
</div>
<script> 
    var clipboard = new Clipboard('.fa-clipboard');
      $(".fa-clipboard").click(function(){
      clipboard.on('success', function(){
        swal({   
          title: "",   
          text: '复制成功',
          icon: "success", 
          showConfirmButton: true
          });
        });
    });  
</script>

    

    

    
      
    
    
      <div>
        <div id="reward-container">
  <div></div>
  <button id="reward-button" disable="enable" onclick="var qr = document.getElementById(&quot;qr&quot;); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
    打赏
  </button>
  <div id="qr" style="display: none;">

    
      
      
        
      
      <div style="display: inline-block">
        <img src="/images/wechatpay.jpg" alt="Melville 微信支付">
        <p>微信支付</p>
      </div>
    
      
      
        
      
      <div style="display: inline-block">
        <img src="/images/alipay.jpg" alt="Melville 支付宝">
        <p>支付宝</p>
      </div>
    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/博客/" rel="tag"><i class="fa fa-tag"></i> 博客</a>
          
            <a href="/tags/hexo/" rel="tag"><i class="fa fa-tag"></i> hexo</a>
          
            <a href="/tags/next/" rel="tag"><i class="fa fa-tag"></i> next</a>
          
            <a href="/tags/主题/" rel="tag"><i class="fa fa-tag"></i> 主题</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/posts/a-2019-01-09-14-12-57.html" rel="next" title="史上最全hexo+GitHubPages搭建个人博客">
                <i class="fa fa-chevron-left"></i> 史上最全hexo+GitHubPages搭建个人博客
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/posts/a-2019-01-10-15-32-40.html" rel="prev" title="hexo 搭建博客添加自定义域名">
                hexo 搭建博客添加自定义域名 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  
    <div class="comments" id="comments">
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/images/avatar.png" alt="Melville">
            
              <p class="site-author-name" itemprop="name">Melville</p>
              <div class="site-description motion-element" itemprop="description">改革春风吹满地</div>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">20</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  
                    
                      <a href="/categories/">
                    
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">13</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  
                    
                      <a href="/tags/">
                    
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">38</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://github.com/do-do-do" title="GitHub &rarr; https://github.com/do-do-do" rel="external nofollow noopener noreferrer" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://www.weibo.com/3938468211/profile?rightmod=1&wvr=6&mod=personinfo&is_all=1" title="WeiBo &rarr; https://www.weibo.com/3938468211/profile?rightmod=1&wvr=6&mod=personinfo&is_all=1" rel="external nofollow noopener noreferrer" target="_blank"><i class="fa fa-fw fa-weibo"></i>WeiBo</a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="/y.dark.woood@gmail.com" title="E-Mail &rarr; y.dark.woood@gmail.com"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://twitter.com/Melville_IT_Dog" title="Twitter &rarr; https://twitter.com/Melville_IT_Dog" rel="external nofollow noopener noreferrer" target="_blank"><i class="fa fa-fw fa-twitter"></i>Twitter</a>
                </span>
              
            </div>
          

          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-inline">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-umbrella"></i>
                友情链接
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.aqh.space" title="https://www.aqh.space" rel="external nofollow noopener noreferrer" target="_blank">qinghua</a>
                  </li>
                
              </ul>
            </div>
          

          
            
          
          

        </div>
      </div>

      
      <!--noindex-->
        <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
            
            
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#写在前面"><span class="nav-text">写在前面</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#1-下载主题"><span class="nav-text">1. 下载主题</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#2-站点配置"><span class="nav-text">2. 站点配置</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#2-1-站点文件的基本配置参数"><span class="nav-text">2.1 站点文件的基本配置参数</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-2-参数配置"><span class="nav-text">2.2 参数配置</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-1-配置网站"><span class="nav-text">2.2.1 配置网站</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-2-配置网址"><span class="nav-text">2.2.2 配置网址</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-3-配置主题"><span class="nav-text">2.2.3 配置主题</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-4-配置部署参数"><span class="nav-text">2.2.4 配置部署参数</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#3-主题配置"><span class="nav-text">3. 主题配置</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#3-1-选择主题风格-Scheme"><span class="nav-text">3.1 选择主题风格 Scheme</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-2-设置语言"><span class="nav-text">3.2 设置语言</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-3-设置菜单设置"><span class="nav-text">3.3 设置菜单设置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-4-设置侧边栏位置及显示"><span class="nav-text">3.4 设置侧边栏位置及显示</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-5-添加侧边栏社交链接"><span class="nav-text">3.5 添加侧边栏社交链接</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-6-关闭网站动画效果"><span class="nav-text">3.6 关闭网站动画效果</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-7-设置网站图标"><span class="nav-text">3.7 设置网站图标</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-8-设置头像"><span class="nav-text">3.8 设置头像</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-9-网页底部显示建站时间和图标修改"><span class="nav-text">3.9 网页底部显示建站时间和图标修改</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-10-去掉网站底部显示的-“由hexo强力驱动”-字样"><span class="nav-text">3.10 去掉网站底部显示的 “由hexo强力驱动” 字样</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-11-增加评论功能"><span class="nav-text">3.11 增加评论功能</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-12-禁用指定文章的评论功能"><span class="nav-text">3.12 禁用指定文章的评论功能</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-13-增加阅读统计"><span class="nav-text">3.13 增加阅读统计</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-14-开启微信支付宝打赏功能"><span class="nav-text">3.14 开启微信支付宝打赏功能</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-15-修改打赏部分字体动画"><span class="nav-text">3.15 修改打赏部分字体动画</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-16-增加公益404页面"><span class="nav-text">3.16 增加公益404页面</span></a></li></ol></li></ol></div>
            

          </div>
        </div>
      <!--/noindex-->
      

      
        <div class="back-to-top">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>
  


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2018 – <span itemprop="copyrightYear">2019</span>
  <span class="with-love" id="animate">
    <i class="fa fa-snowflake-o"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Melville</span>

  

  
</div>









        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="post-meta-item-icon">
      <i class="fa fa-user"></i>
    </span>
    <span class="site-uv" title="总访客量">
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  

  
    <span class="post-meta-divider">|</span>
  

  
    <span class="post-meta-item-icon">
      <i class="fa fa-users"></i>
    </span>
    <span class="site-pv" title="总访问量">
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>









        
      </div>
    </footer>

    

    

    

    
  </div>

  

<script>
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>







  






  



  
    
    
  
  <script color="0,0,255" opacity="0.5" zindex="-1" count="99" src="/lib/canvas-nest/canvas-nest.min.js"></script>













  
  <script src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script src="/lib/fancybox/source/jquery.fancybox.pack.js"></script>


  


  <script src="/js/utils.js?v=7.1.2"></script>

  <script src="/js/motion.js?v=7.1.2"></script>



  
  


  <script src="/js/affix.js?v=7.1.2"></script>

  <script src="/js/schemes/pisces.js?v=7.1.2"></script>




  
  <script src="/js/scrollspy.js?v=7.1.2"></script>
<script src="/js/post-details.js?v=7.1.2"></script>



  


  <script src="/js/next-boot.js?v=7.1.2"></script>


  

  

  

  
  

<script src="//cdn1.lncld.net/static/js/3.11.1/av-min.js"></script>



<script src="//unpkg.com/valine/dist/Valine.min.js"></script>

<script>
  var GUEST = ['nick', 'mail', 'link'];
  var guest = 'nick,mail';
  guest = guest.split(',').filter(function(item) {
    return GUEST.indexOf(item) > -1;
  });
  new Valine({
    el: '#comments',
    verify: true,
    notify: true,
    appId: 'pvhiBwpfHOUBspkJ5iEJ5LFw-gzGzoHsz',
    appKey: 'LrKlAVEWOYfv1JwbdQGXAl3K',
    placeholder: '欢迎留言',
    avatar: 'mm',
    meta: guest,
    pageSize: '10' || 10,
    visitor: false,
    lang: 'zh-cn' || 'zh-cn'
  });
</script>




  


  
  <script>
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url).replace(/\/{2,}/g, '/');
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x"></i></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x"></i></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  

  

  

  
  <script>
    (function(){
      var bp = document.createElement('script');
      var curProtocol = window.location.protocol.split(':')[0];
      bp.src = (curProtocol === 'https') ? 'https://zz.bdstatic.com/linksubmit/push.js' : 'http://push.zhanzhang.baidu.com/push.js';
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(bp, s);
    })();
  </script>


  

  

  

  

  

  
<script>
  $('.highlight').not('.gist .highlight').each(function(i, e) {
    var $wrap = $('<div>').addClass('highlight-wrap');
    $(e).after($wrap);
    $wrap.append($('<button>').addClass('copy-btn').append('复制').on('click', function(e) {
      var code = $(this).parent().find('.code').find('.line').map(function(i, e) {
        return $(e).text();
      }).toArray().join('\n');
      var ta = document.createElement('textarea');
      var yPosition = window.pageYOffset || document.documentElement.scrollTop;
      ta.style.top = yPosition + 'px'; // Prevent page scroll
      ta.style.position = 'absolute';
      ta.style.opacity = '0';
      ta.readOnly = true;
      ta.value = code;
      document.body.appendChild(ta);
      ta.select();
      ta.setSelectionRange(0, code.length);
      ta.readOnly = false;
      var result = document.execCommand('copy');
      
        if (result) $(this).text('复制成功');
        else $(this).text('复制失败');
      
      ta.blur(); // For iOS
      $(this).blur();
    })).on('mouseleave', function(e) {
      var $b = $(this).find('.copy-btn');
      setTimeout(function() {
        $b.text('复制');
      }, 300);
    }).append(e);
  })
</script>


  

  

</body>
</html>
